package krow.dev.gunpobus.control.http;

import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

import com.android.volley.VolleyError;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.ImageLoader.ImageContainer;

public class ThumbnailResponseListener implements ImageLoader.ImageListener {
	
	private ImageView mImageView;

	public ThumbnailResponseListener(ImageView imageView) {
		mImageView = imageView;
	}

	@Override
	public void onErrorResponse(VolleyError error) {

	}

	@Override
	public void onResponse(ImageContainer response, boolean isImmediate) {
		if(response.getBitmap() == null){
			return ;
		}
		mImageView.setScaleType(ScaleType.CENTER_CROP);
		mImageView.setImageBitmap(response.getBitmap());
		mImageView.invalidate();
	}
}
